Functions
Camera Configuration

Includes APIs for enumerating cameras, creating handles, and turning on cameras. More...

Functions

def MV_CC_EnumDevices (nTLayerType, stDevList)
 Enumerates devices. More...
 
def MV_CC_EnumDevicesEx (nTLayerType, stDevList, strManufacturerName)
 Enumerates devices based on manufacturer name. More...
 
def MV_CC_EnumDevicesEx2 (nTLayerType, stDevList, strManufacturerName, enSortMethod)
 Enumerates devices, supporting enumerating devices by specified sorting method and filtering by manufacturer name. More...
 
def MV_CC_IsDeviceAccessible (stDevInfo, nAccessMode)
 Checks if the specified device can be accessed. More...
 
def MV_CC_CreateHandle (self, stDevInfo)
 Creates device handle. More...
 
def MV_CC_DestroyHandle (self)
 Destroys the device handle. More...
 
def MV_CC_OpenDevice (self, nAccessMode=MV_ACCESS_Exclusive, nSwitchoverKey=0)
 Turns on the device. More...
 
def MV_CC_CloseDevice (self)
 Turns off the device. More...
 
def MV_CC_IsDeviceConnected (self)
 Checks if the device is connected. More...
 

Detailed Description

Includes APIs for enumerating cameras, creating handles, and turning on cameras.

Function Documentation

◆ MV_CC_EnumDevices()

def MvCameraControl_class.MV_CC_EnumDevices (   nTLayerType,
  stDevList 
)
static

Enumerates devices.

Parameters
nTLayerType[IN] It refers to the transport layer protocol type. For more details, refer to CameraParams_const.py.
Transport Layer Protocol Type Value Description
MV_UNKNOW_DEVICE 0x00000000 Unknown device type.
MV_GIGE_DEVICE 0x00000001 GigE vision device.
MV_1394_DEVICE 0x00000002 1394-a/b device.
MV_USB_DEVICE 0x00000004 USB3 vision device.
MV_CAMERALINK_DEVICE 0x00000008 Serial port device, including Camera Link device and serial port light controller.
MV_VIR_GIGE_DEVICE 0x00000010 Virtual GigE vision device.
MV_VIR_USB_DEVICE 0x00000020 Virtual USB3 vision device.
MV_GENTL_GIGE_DEVICE 0x00000040 Self-developed NIC-based GigE vision device.
MV_GENTL_CAMERALINK_DEVICE 0x00000080 Camera Link device.
MV_GENTL_CXP_DEVICE 0x00000100 CoaXPress device.
MV_GENTL_XOF_DEVICE 0x00000200 XoF device.
MV_GENTL_VIR_DEVICE 0x00000800 Device connected to the virtual frame grabber.
pstDevList[IN][OUT] It refers to the device list.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
The memory of device list is internally allocated. When this API is called in multiple threads, the SDK will release and apply for the device list memory. It is recommended to avoid multithreaded enumeration operations.
For the parameter nTLayerType, the following parameters are supported: MV_GIGE_DEVICE, MV_1394_DEVICE, MV_USB_DEVICE, and MV_CAMERALINK_DEVICE. MV_GIGE_DEVICE sends out information of all GigE vision devices (including virtual GigE vision devices and GigE vision devices of GenTL), and MV_USB_DEVICE sends out information of USB3 vision devices (including virtual USB3 vision devices).

◆ MV_CC_EnumDevicesEx()

def MvCameraControl_class.MV_CC_EnumDevicesEx (   nTLayerType,
  stDevList,
  strManufacturerName 
)
static

Enumerates devices based on manufacturer name.

Parameters
nTLayerType[IN] It refers to the transport layer protocol type. For more details, refer to CameraParams_const.py.
Transport Layer Protocol Type Value Description
MV_UNKNOW_DEVICE 0x00000000 Unknown device type.
MV_GIGE_DEVICE 0x00000001 GigE vision device.
MV_1394_DEVICE 0x00000002 1394-a/b device.
MV_USB_DEVICE 0x00000004 USB3 vision device.
MV_CAMERALINK_DEVICE 0x00000008 Serial port device, including Camera Link device and serial port light controller.
MV_VIR_GIGE_DEVICE 0x00000010 Virtual GigE vision device.
MV_VIR_USB_DEVICE 0x00000020 Virtual USB3 vision device.
MV_GENTL_GIGE_DEVICE 0x00000040 Self-developed NIC-based GigE vision device.
MV_GENTL_CAMERALINK_DEVICE 0x00000080 Camera Link device.
MV_GENTL_CXP_DEVICE 0x00000100 CoaXPress device.
MV_GENTL_XOF_DEVICE 0x00000200 XoF device.
MV_GENTL_VIR_DEVICE 0x00000800 Device connected to the virtual frame grabber.
pstDevList[IN][OUT] It refers to the device list.
strManufacturerName[IN] It refers to the manufacturer name.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
For the parameter nTLayerType, the following parameters are supported: MV_GIGE_DEVICE, MV_1394_DEVICE, MV_USB_DEVICE, and MV_CAMERALINK_DEVICE.
  • MV_GIGE_DEVICE sends out information of all GigE vision devices (including virtual GigE vision devices and GigE vision devices of GenTL).
  • MV_USB_DEVICE sends out information of USB3 vision devices (including virtual USB3 vision devices).
  • The memory of device list is internally allocated. When this API is called in multiple threads, the SDK will release and apply for the device list memory. It is recommended to avoid multithreaded enumeration operations.

◆ MV_CC_EnumDevicesEx2()

def MvCameraControl_class.MV_CC_EnumDevicesEx2 (   nTLayerType,
  stDevList,
  strManufacturerName,
  enSortMethod 
)
static

Enumerates devices, supporting enumerating devices by specified sorting method and filtering by manufacturer name.

Parameters
nTLayerType[IN] It refers to the transport layer protocol type. Different types of devices are distinguished.
Transport Layer Protocol Type Value Description
MV_UNKNOW_DEVICE 0x00000000 Unknown device type.
MV_GIGE_DEVICE 0x00000001 GigE vision device.
MV_1394_DEVICE 0x00000002 1394-a/b device.
MV_USB_DEVICE 0x00000004 USB3 vision device.
MV_CAMERALINK_DEVICE 0x00000008 Serial port device, including Camera Link device and serial port light controller.
MV_VIR_GIGE_DEVICE 0x00000010 Virtual GigE vision device.
MV_VIR_USB_DEVICE 0x00000020 Virtual USB3 vision device.
MV_GENTL_GIGE_DEVICE 0x00000040 Self-developed NIC-based GigE vision device.
MV_GENTL_CAMERALINK_DEVICE 0x00000080 Camera Link device.
MV_GENTL_CXP_DEVICE 0x00000100 CoaXPress device.
MV_GENTL_XOF_DEVICE 0x00000200 XoF device.
MV_GENTL_VIR_DEVICE 0x00000800 Device connected to the virtual frame grabber.
pstDevList[IN][OUT] It refers to the device list.
strManufacturerName[IN] It refers to the manufacturer name (NULL means not filtering).
enSortMethod[IN] It refers to the sorting method.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • The memory of device list is internally allocated. When this API is called in multiple threads, the SDK will release and apply for the device list memory. It is recommended to avoid multithreaded enumeration operations.
  • strManufacturerName can be set to NULL, which indicates enumerating all devices according to the specified sorting type; if not set to NULL, the sorted device list of specified manufacturers will be returned.

◆ MV_CC_IsDeviceAccessible()

def MvCameraControl_class.MV_CC_IsDeviceAccessible (   stDevInfo,
  nAccessMode 
)
static

Checks if the specified device can be accessed.

Parameters
pstDevInfo[IN] It refers to the device information.
nAccessMode[IN] It refers to the access permission. For more details, see CameraParams_const.py.
Constant Value Description
MV_ACCESS_Exclusive 1 The device owns exclusive permission. For other apps, only the CCP register is allowed to be read.
MV_ACCESS_ExclusiveWithSwitch 2 The device can be preemptively accessed under mode 5 and then turned on with exclusive permission.
MV_ACCESS_Control 3 The device can be turned on with control permission. For other apps, all registers are allowed to be read.
MV_ACCESS_ControlWithSwitch 4 The device can be preemptively accessed under mode 5 and then turned on with control permission.
MV_ACCESS_ControlSwitchEnable 5 The device can be turned on with preemptible control permission.
MV_ACCESS_ControlSwitchEnableWithKey 6 The device can be preemptively accessed under mode 5 and then turned on with preemptible control permission.
MV_ACCESS_Monitor 7 The device can be turned on in read mode. It is applicable to devices under control permission.
Remarks
  • For GigE vision devices, you can read the device CCP register value to check the current access permission. False will be returned if the device (Self-developed NIC-based GigE vision device / GigE vision device) does not support the modes MV_ACCESS_ExclusiveWithSwitch, MV_ACCESS_ControlWithSwitch, MV_ACCESS_ControlSwitchEnable, and MV_ACCESS_ControlSwitchEnableWithKey. Currently the device does not support the 4 preemption modes, neither do the devices from other mainstream manufacturers.
  • For GigE vision devices or self-developed NIC-based GigE vision devices, when the API is called, it will return whether the device can be connected based on the value of nAccessMode.
  • For virtual devices, USB3 vision devices, CoaXPress devices, XoF devices, and Camera Link devices, the parameter nAccessMode is invalid. The API returns true if the camera is not connected, and returns false if the camera is connected to a third-party device.
Note
For Camera Link devices, this API is not supported, and false will be returned.

◆ MV_CC_CreateHandle()

def MvCameraControl_class.MV_CC_CreateHandle (   self,
  stDevInfo 
)

Creates device handle.

Parameters
handle[IN][OUT] It refers to the device handle.
pstDevInfo[IN] It refers to the device information.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
  • Create required resources within library and initialize internal module according to the input device information.
  • SDK log file will be created by default when you call the API to create the device handle. You can set the log level to off in the log configuration file to disable the generation of log files.

◆ MV_CC_DestroyHandle()

def MvCameraControl_class.MV_CC_DestroyHandle (   self)

Destroys the device handle.

Parameters
handle[IN] It refers to the device handle.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
If the frame grabber handle is passed, the frame grabber handle will be destroyed.

◆ MV_CC_OpenDevice()

def MvCameraControl_class.MV_CC_OpenDevice (   self,
  nAccessMode = MV_ACCESS_Exclusive,
  nSwitchoverKey = 0 
)

Turns on the device.

Parameters
handle[IN] It refers to the device handle.
nAccessMode[IN] It refers to the access permission. For more details, see CameraParams_const.py.
Constant Value Description
MV_ACCESS_Exclusive 1 The device owns exclusive permission. For other apps, only the CCP register is allowed to be read.
MV_ACCESS_ExclusiveWithSwitch 2 The device can be preemptively accessed under mode 5 and then turned on with exclusive permission.
MV_ACCESS_Control 3 The device can be turned on with control permission. For other apps, all registers are allowed to be read.
MV_ACCESS_ControlWithSwitch 4 The device can be preemptively accessed under mode 5 and then turned on with control permission.
MV_ACCESS_ControlSwitchEnable 5 The device can be turned on with preemptible control permission.
MV_ACCESS_ControlSwitchEnableWithKey 6 The device can be preemptively accessed under mode 5 and then turned on with preemptible control permission.
MV_ACCESS_Monitor 7 The device can be turned on in read mode. It is applicable to devices under control permission.
nSwitchoverKey[IN] It refers to the secret key for switching access permission. Only valid for GigE vision devices.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
You can find the specific device and connect to it according to the configured device parameters.
  • The parameters nAccessMode and nSwitchoverKey are optional, and the device access mode is exclusive by default.
  • For GigE vision devices, the camera firmware does not support the following preemption modes: MV_ACCESS_ExclusiveWithSwitch, MV_ACCESS_ControlWithSwitch, MV_ACCESS_ControlSwitchEnable, and MV_ACCESS_ControlSwitchEnableWithKey.
  • For self-developed NIC-based GigE vision devices, only the following access permissions are supported: MV_ACCESS_Exclusive, MV_ACCESS_Control, and MV_ACCESS_Monitor.
  • For USB3 vision, CoaxPress, Camera Link (MV_CAMERALINK_DEVICE and MV_GENTL_CAMERALINK_DEVICE), XoF, virtual GigE vision, and virtual USB3 vision devices, the parameters nAccessMode and nSwitchoverKey are invalid, and the device is turned on via MV_ACCESS_Control by default.
  • This API allows turning on GigE vision devices without enumeration, but it does not support turning on USB3 vision or GenTL devices without enumeration.

◆ MV_CC_CloseDevice()

def MvCameraControl_class.MV_CC_CloseDevice (   self)

Turns off the device.

Parameters
handle[IN] It refers to the device handle.
Returns
Returns MV_OK for success, and returns corresponding Error Code for failure.
Remarks
After connecting to device by calling MV_CC_OpenDevice() , you can call this API to disconnect and release resources.

◆ MV_CC_IsDeviceConnected()

def MvCameraControl_class.MV_CC_IsDeviceConnected (   self)

Checks if the device is connected.

Parameters
handle[IN] It refers to the device handle.
Returns
Returns true if the device is connected, and returns false if the device is not connected or disconnected.